// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.core.skinnedmodel.shader;

import java.util.ArrayList;

public final class ShaderManager {
    public static final ShaderManager instance = new ShaderManager();
    private final ArrayList<Shader> shaders = new ArrayList();

    private Shader getShader(String string, boolean _boolean) {
        for (int _int = 0; _int < this.shaders.size(); _int++) {
            Shader shader = (Shader)this.shaders.get(_int);
            if (string.equals(shader.name) && _boolean == shader.bStatic) {
                return shader;
            }
        }

        return null;
    }

    public Shader getOrCreateShader(String name, boolean bStatic) {
        Shader shader0 = this.getShader(name, bStatic);
        if (shader0 != null) {
            return shader0;
        } else {
            for (int _int = 0; _int < this.shaders.size(); _int++) {
                Shader shader1 = (Shader)this.shaders.get(_int);
                if (shader1.name.equalsIgnoreCase(name) && !shader1.name.equals(name)) {
                    throw new IllegalArgumentException("shader filenames are case-sensitive");
                }
            }

            shader0 = new Shader(name, bStatic);
            this.shaders.add(shader0);
            return shader0;
        }
    }
}
